package com.rjwh.dingdong.client.mvp.model.impl;

import com.aishua.lib.task.AsResult;
import com.rjwh.dingdong.client.constant.NetConstant;
import com.rjwh.dingdong.client.mvp.BaseModel;
import com.rjwh.dingdong.client.mvp.BasePresenter;
import com.rjwh.dingdong.client.mvp.model.IDrawBookDetailCommentListModel;
import com.rjwh.dingdong.client.network.HttpWebService;
import com.rjwh.dingdong.client.network.HttpWebServiceCallBack;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Kay
 * @ClassName DrawBookDetailCommentListModel
 * @Description
 * @date 2016-8-13
 * @history 2016-8-13 author: description:
 */
public class DrawBookDetailCommentListModel extends BaseModel implements IDrawBookDetailCommentListModel, HttpWebServiceCallBack {

    public DrawBookDetailCommentListModel(BasePresenter basePresenter) {
        super(basePresenter);
    }

    /**
     * 绘本评论列表
     *
     * @param bookid    绘本编码
     * @param pageindex 页面索引
     */
    @Override
    public void doGetPictureBookCommentList(int bookid, int pageindex, boolean isRefresh) {
        Map<String, String> getPictureBookCommentListParams = new HashMap<>();
        getPictureBookCommentListParams.put("bookid", Integer.toString(bookid));
        getPictureBookCommentListParams.put("pageindex", Integer.toString(pageindex));
        HttpWebService.getDataFromServer(NetConstant.GETPICTUREBOOKCOMMENTLIST, getPictureBookCommentListParams, isRefresh, this);
    }

    @Override
    public void onServerDataAcquired(int businessType, AsResult mAsResult, boolean isRefresh) {
        if (getBasePresenter() != null) {
            getBasePresenter().onServerDataAcquired(businessType, mAsResult, isRefresh);
        }
    }
}
